package com.tangyuan.video.controller;

import com.tangyuan.common.result.Result;
import com.tangyuan.video.service.IMusicService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigInteger;

@RestController
@RequestMapping("/video/music")
@Slf4j
public class MusicController {

    @Autowired
    private IMusicService musicService;
    //发布小视频接口
    @PostMapping("/frequency")
    public Result saveApplyFrequency(@RequestParam BigInteger musicId,
                                     @RequestHeader("Authorization") String token) {
        Result result =  musicService.saveApplyFrequency(musicId,token);
        return result;
    }

    //用户搜索发布视频音乐
    @GetMapping("/searchMusic")
    public Result userSearch(@RequestParam Integer pageNum,
                             @RequestParam Integer pageSize,
                             @RequestParam String musicName,
                             @RequestHeader(name = "userId", required = false) Long userId) {
        return musicService.searchMusic(pageNum,pageSize,musicName,userId);
    }
}
